package com.niodata.dt.fs;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathFilter;

public class PathFilters {

  public static PathFilter regexFilter(String nameRegex) {
    return new PathFilter() {
      @Override
      public boolean accept(Path path) {
        if (nameRegex == null) {
          return true;
        } else {
          return path.getName().matches(nameRegex);
        }
      }
    };
  }
}
